# Replication for Appendices 
rm(list = ls())
library(dplyr)
library(texreg)
library(survival)

# Data ####
d <- read.csv("data.csv")

# Appendix A: Descriptive Statistics #####
x <- d %>% dplyr::select(Negotiation, demref, demref_v2x_regime_amb_autlib, 
                  demref_v2x_regime_amb_demtrans,
                  demref_lexical_autlib, demref_lexical_demtrans, 
                  demref_gwf_demtrans,
                  polyarchy,
                  RebStrBin.imp,
                  Ethnic.incomp,
                  ExChange,
                  duration_dy_ln,
                  imp.gdppcln,
                  imp.popln,
                  Intensity,
                  Region, 
                  oda.pc.ln,
                  intervention.dem, medprev2y,
                  protest, v2xeg_eqdr,
                  res_dep, resmax.imp, sanctioned,
                  BdBest_ln, UNPKO.total.ln, tsln)

desstat <- summary(x)

d.n    <- apply(x, 2, function(x){ return(length(na.omit(x)))})
d.mean <- apply(x, 2, mean, na.rm = T)
d.sd  <- apply(x, 2, sd, na.rm = T)
d.min <- apply(x, 2, min, na.rm = T)
d.max <- apply(x, 2, max, na.rm = T)
d.p25 <- apply(x, 2, quantile, na.rm = T, probs = 0.25 )
d.p75 <- apply(x, 2, quantile, na.rm = T, probs = 0.75 )

labels <- c("Negotiation", "Democratic Reform",
            "Authoritarian Lib. (Lexical)", 
            "Democratic Trans. (Lexical)",
            "Authoritarian Lib. (VDem)", 
            "Democratic Trans. (VDem)",
            "Democratic Trans. (GWF)",
            "Polyarchy",
            "Rebel Strength",
            "Ethnic",
            "Executive Change",
            "Duration ln",
            "GDP pc ln",
            "Pop. ln",
            "Intensity",
            "Region", 
            "Foreign Aid",
            "Intervention by a democracy",
            "Previous Mediation",
            "Protest", 
            "Social Inequality",
            "Oil production", 
            "Natural resources", 
            "Int. Sanctions",
            "Battle Deaths ln", 
            "UN PKO Personnel ln", 
            "Time Since Last Neg")

output <- round(cbind(d.n, d.mean, d.sd, d.min, d.max, d.p25, d.p75),2)

output <- cbind(labels, output)

## Appendix A: Table III Frequency of Negotiation by Democratization ####
table(d$Negotiation, d$demref) # Appendix A Table III
apply(table(d$Negotiation, d$demref), 2, sum) # Appendix A Table III
# corresponding percentages
round((table(d$Negotiation, d$demref)[,1] / sum(table(d$Negotiation, d$demref)[,1])) * 100,2)
round((table(d$Negotiation, d$demref)[,2] / sum(table(d$Negotiation, d$demref)[,2])) * 100,2)

# Appendix B: Table I Additional Analysis  ####
d <- read.csv("data.csv")

# Factorize
d$Intensity <- as.factor(d$Intensity)
d$Region <- as.factor(d$Region)
d$Incompatibility <- as.factor(d$Incompatibility)

## Table I: Additional Controls ####
#model 1 
fx1 <- as.formula (Negotiation ~ polyarchy + demref + duration_dy_ln + imp.gdppcln + imp.popln + Intensity +
                      Region + tsln + tsln2 + tsln3 + 
                      protest + v2xeg_eqdr +  intervention.dem + res_dep + resmax.imp + sanctioned)

#model 2
fx2 <- as.formula (Negotiation ~ polyarchy + demref + duration_dy_ln + imp.gdppcln + imp.popln + Intensity +
                      Region + RebStrBin.imp + Ethnic.incomp + ExChange + oda.pc.ln + medprev2y +
                      tsln + tsln2 + tsln3 +
                      protest + v2xeg_eqdr +  intervention.dem + res_dep + resmax.imp + sanctioned)

#model 3
fx3 <- as.formula (Negotiation ~ polyarchy + demref + duration_dy_ln + imp.gdppcln + imp.popln + Intensity +
                      Region + RebStrBin.imp + Ethnic.incomp + ExChange + oda.pc.ln + medprev2y + 
                      BdBest_ln + UNPKO.total.ln +
                      tsln + tsln2 + tsln3 +
                      protest + v2xeg_eqdr + intervention.dem + res_dep + resmax.imp + sanctioned)

mx1 <- glm(formula = fx1, data = d, family = binomial(link = "logit"))
mx2 <- glm(formula = fx2, data = d, family = binomial(link = "logit"))
mx3 <- glm(formula = fx3, data = d, family = binomial(link = "logit"))

# takes time:
mx4 <- clogit(Negotiation ~ polyarchy + demref + duration_dy_ln + imp.gdppcln + imp.popln +
                  Intensity + ExChange + oda.pc.ln + medprev2y +
                  tsln + tsln2 + tsln3 + BdBest_ln + UNPKO.total.ln + 
                  protest + v2xeg_eqdr +  intervention.dem + res_dep + resmax.imp +  sanctioned +  
                 strata(DyadId), data = d)

screenreg(list(mx1, mx2, mx3, mx4))

# output: 
htmlreg(list(mx1, mx2, mx3, mx4), file = "addmodels_1.doc", inline.css = FALSE,
        doctype = TRUE, html.tag = TRUE, head.tag = TRUE, body.tag = TRUE,
        stars = c(0.001, 0.01, 0.05, 0.10),
        star.symbol = c("*"),
        symbol = c("&#8224;"),
        caption = "Table I: Additional Controls",
        caption.above = T,
        custom.model.names = c("Model 1", "Model 2", "Model 3", "Model 4"),
        custom.coef.map = list(polyarchy = "Polyarchy",
                               demref = "Democratic Reform (t-1)",
                               duration_dy_ln = "Duration",
                               imp.gdppcln = "GDP pc ln",
                               imp.popln = "Pop pc ln",
                               Intensity1 = "Minor Conflict",
                               Intensity2 = "Major Conflict",
                               RebStrBin.imp = "Rebel Strength", 
                               ExChange = "Executive Change",
                               oda.pc.ln = "Foreign Aid",
                               medprev2y = "Previous Mediation",
                               BdBest_ln = "Battle Deaths ln",
                               UNPKO.total.ln = "UN Personnel ln",
                               protest = "Protest",
                               v2xeg_eqdr  = "Social Inequality",
                               res_dep = "Oil production", 
                               resmax.imp = "Natural resources",
                               sanctioned = "Int. Sanctions",
                               Region2  = "Mid East",
                               Region3  = "Asia",
                               Region4  = "Africa",
                               Region5  = "Americas",
                               tsln     = "Time Since Last Neg.",
                               tsln2    = "Time Since Last Neg.^2",
                               tsln3    = "Time Since Last Neg.^3"
        )
)


## Table II: Additional Controls (Markov transition and Inaugural) #####
fmt <- as.formula (Negotiation ~ polyarchy + demref + 
                      duration_dy_ln + imp.gdppcln + imp.popln + Intensity +
                      Region + RebStrBin.imp + Ethnic.incomp + ExChange + oda.pc.ln + medprev2y +
                      protest + v2xeg_eqdr +  intervention.dem + res_dep + resmax.imp + sanctioned)

mx7 <- glm(formula = fmt, data = d[d$Negotiation_lag == 0,], family = binomial(link = "logit"))
mx8 <- glm(formula = fmt, data = d[d$Negotiation_lag == 1,], family = binomial(link = "logit"))

# Inaugural #
fx9 <- as.formula (Negotiation_inaugural ~ 
                      polyarchy + demref + 
                      duration_dy_ln + imp.gdppcln + imp.popln + Intensity +
                      Region + RebStrBin.imp + Ethnic.incomp + ExChange + oda.pc.ln + medprev2y +
                      protest + v2xeg_eqdr +  intervention.dem + res_dep + resmax.imp + sanctioned)

mx9  <-  glm(formula = fx9, data = d[d$Negotiation_inaugural >= 0,], 
             family = binomial(link = "logit"))

screenreg(list(mx7, mx8, mx9))

htmlreg(list(mx7, mx8, mx9), file = "addmodels_2.doc", inline.css = FALSE,
        doctype = TRUE, html.tag = TRUE, head.tag = TRUE, body.tag = TRUE,
        stars = c(0.001, 0.01, 0.05, 0.10),
        star.symbol = c("*"),
        symbol = c("&#8224;"),
        caption = "Table II: Additional Controls (Markov Transition & Inaugural)",
        caption.above = T,
        custom.model.names = c("Neg. Onset", "Neg. Cont.", "Inaugural"),
        custom.coef.map = list(polyarchy = "Polyarchy",
                               demref = "Democratic Reform (t-1)",
                               duration_dy_ln = "Duration",
                               imp.gdppcln = "GDP pc ln",
                               imp.popln = "Pop pc ln",
                               Intensity1 = "Minor Conflict",
                               Intensity2 = "Major Conflict",
                               RebStrBin.imp = "Rebel Strength", 
                               ExChange = "Executive Change",
                               oda.pc.ln = "Foreign Aid",
                               medprev2y = "Previous Mediation",
                               BdBest_ln = "Battle Deaths ln",
                               UNPKO.total.ln = "UN Personnel ln",
                               protest = "Protest",
                               v2xeg_eqdr  = "Social Inequality",
                               res_dep = "Oil production", 
                               resmax.imp = "Natural resources",
                               sanctioned = "Int. Sanctions",
                               Region2  = "Mid East",
                               Region3  = "Asia",
                               Region4  = "Africa",
                               Region5  = "Americas",
                               tsln     = "Time Since Last Neg.",
                               tsln2    = "Time Since Last Neg.^2",
                               tsln3    = "Time Since Last Neg.^3"
        )
)


## Table III: Modelling Democratic Reforms as Outcome  ####
d <- read.csv("data.csv")

# Factorize
d$Region <- as.factor(d$Region)

dx <- d %>% group_by(GWNoA, Year) %>%
   mutate(neg_max = max(Negotiation))  %>%
   mutate(neglag_max = max(Negotiation_lag))  %>%
   mutate(RebStrBin.imp_max = max(RebStrBin.imp)) %>% mutate(duration_dy_ln = max(duration_dy_ln)) %>% 
   mutate( Ethnic.incomp  = max( Ethnic.incomp )) %>% 
   mutate( intervention.dem  = max( intervention.dem)) %>%
   mutate(medprev2y = max(medprev2y)) %>% 
   mutate(res_dep = max(res_dep)) %>% 
   mutate(resmax.imp = max(resmax.imp)) %>%
   mutate(Intensity_max = max(Intensity) ) %>%
   unique %>% ungroup()

dx <- dx %>% select(GWNoA, Year,  
                   demref_poly_p2_xp2, neglag_max, neg_max, RebStrBin.imp_max, 
                   duration_dy_ln, Region, imp.gdppcln,
                   Region, imp.gdppcln,imp.popln, oda.pc.ln,
                  intervention.dem, Ethnic.incomp, medprev2y,
                  protest, v2xeg_eqdr,res_dep, resmax.imp, sanctioned,
                  res_dep, resmax.imp, Intensity_max) %>% unique

dx$Intensity_max <- as.factor(dx$Intensity_max)

fdemref <- as.formula (demref_poly_p2_xp2 ~ neglag_max +
                          + duration_dy_ln + imp.gdppcln + imp.popln + Intensity_max + 
                          Region + RebStrBin.imp_max + oda.pc.ln + medprev2y + Ethnic.incomp +
                          protest + v2xeg_eqdr +  intervention.dem + res_dep + resmax.imp + sanctioned
                       )

mdemref  <-  glm(formula = fdemref, data = dx, family = binomial(link = "logit"))
screenreg(list(mdemref))

htmlreg(list(mdemref), file = "model_democ.doc", inline.css = FALSE,
        doctype = TRUE, html.tag = TRUE, head.tag = TRUE, body.tag = TRUE,
        stars = c(0.001, 0.01, 0.05, 0.10),
        star.symbol = c("*"),
        symbol = c("&#8224;"),
        caption = "Table III: Modelling Democratic Reforms",
        caption.above = T,
        custom.model.names = c("Democratization"),
        custom.coef.map = list(neglag_max = "Negotiation (t-1)",
                               polyarchy = "Polyarchy",
                               demref = "Democratic Reform (t-1)",
                               duration_dy_ln = "Duration",
                               imp.gdppcln = "GDP pc ln",
                               imp.popln = "Pop pc ln",
                               Intensity1 = "Minor Conflict",
                               Intensity2 = "Major Conflict",
                               Ethnic.incomp = "Ethnic",
                               RebStrBin.imp = "Rebel Strength", 
                               ExChange = "Executive Change",
                               oda.pc.ln = "Foreign Aid",
                               medprev2y = "Previous Mediation",
                               BdBest_ln = "Battle Deaths ln",
                               UNPKO.total.ln = "UN Personnel ln",
                               protest = "Protest",
                               v2xeg_eqdr  = "Social Inequality",
                               res_dep = "Oil production", 
                               resmax.imp = "Natural resources",
                               sanctioned = "Int. Sanctions",
                               Region2  = "Mid East",
                               Region3  = "Asia",
                               Region4  = "Africa",
                               Region5  = "Americas",
                               tsln     = "Time Since Last Neg.",
                               tsln2    = "Time Since Last Neg.^2",
                               tsln3    = "Time Since Last Neg.^3"
        )
)

# Appendix B: Alternative Measurement 1 ####
## Categorical Dataset Models 1: Negotiation ####

### Data ####
d <- read.csv("data.csv")

# Factorize
d$Intensity <- as.factor(d$Intensity)
d$Region <- as.factor(d$Region)
d$Incompatibility <- as.factor(d$Incompatibility)

# Formulas:
#model 1 
fx1 <- as.formula (Negotiation ~  autlib + demtrans + 
                      duration_dy_ln  + imp.gdppcln + imp.popln + 
                      Intensity + Region + tsln + tsln2 + tsln3)
#model 2
fx2 <- as.formula (Negotiation ~   autlib + demtrans + 
                      duration_dy_ln  +  imp.gdppcln + imp.popln + 
                      Intensity + Region + 
                      RebStrBin.imp + Ethnic.incomp  + medprev2y +
                      tsln + tsln2 + tsln3  )

#model 3
fx3 <- as.formula (Negotiation ~ duration_dy_ln  + imp.gdppcln + imp.popln + Intensity +
                      Region + RebStrBin.imp + Ethnic.incomp  + oda.pc.ln + medprev2y  +
                      tsln + tsln2 + tsln3 + BdBest_ln + UNPKO.total.ln + autlib + demtrans)

#model 4: fixed effect
fx4 <- as.formula(Negotiation ~ autlib + demtrans +
                     duration_dy_ln  + imp.gdppcln + imp.popln + Intensity +
                     medprev2y  + tsln + tsln2 + tsln3 + strata(DyadId))

# Models 7-8 Markov Transition
fx7 <- as.formula (Negotiation ~  autlib + demtrans +
                      duration_dy_ln  +  imp.gdppcln + imp.popln + Intensity +
                      Region + RebStrBin.imp + Ethnic.incomp + medprev2y )

# Model 9: inaugural same with 7-8
fx9 <- fx7

## Lexical ####
d$autlib   <- d$demref_lexical_autlib_dec5_lag
d$demtrans <- d$demref_lexical_demtrans_dec5_lag

d$demtrans[d$autlib > d$demtrans] <- 0
d$autlib[d$autlib < d$demtrans] <- 0


# Models
# First 4
mx1 <- glm(formula = fx1, data = d, family = binomial(link = "logit"))
mx2 <- glm(formula = fx2, data = d, family = binomial(link = "logit"))
mx3 <- glm(formula = fx3, data = d, family = binomial(link = "logit"))
mx4 <- survival::clogit(fx4, data = d)

screenreg(list(mx1, mx2, mx3, mx4))

# markov transition
mx7 <- glm(formula = fx7, data = d[d$Negotiation_lag == 0,], family = binomial(link = "logit"))
mx8 <- glm(formula = fx7, data = d[d$Negotiation_lag == 1,], family = binomial(link = "logit"))
screenreg(list(mx7, mx8))

## model 9: inaugural
mx9 <- glm(formula = fx9, data = d[d$Negotiation_inaugural >= 0,], 
           family = binomial(link = "logit"))

screenreg(list(mx7, mx8, mx9))

# output
lex1 <- mx1
lex2 <- mx2
lex3 <- mx3
lex4 <- mx4
lex7 <- mx7
lex8 <- mx8
lex9 <- mx9

# models with lexical end

## VDEM Categorical ####
d$autlib   <- d$demref_v2x_regime_amb_autlib_dec5_lag
d$demtrans <- d$demref_v2x_regime_amb_demtrans_dec5_lag

d$demtrans[d$autlib > d$demtrans] <- 0
d$autlib[d$autlib < d$demtrans] <- 0

# Models
# First 4
mx1 <- glm(formula = fx1, data = d, family = binomial(link = "logit"))
mx2 <- glm(formula = fx2, data = d, family = binomial(link = "logit"))
mx3 <- glm(formula = fx3, data = d, family = binomial(link = "logit"))
mx4 <- survival::clogit(fx4, data = d)

screenreg(list(mx1, mx2, mx3, mx4))

# markov transition
mx7 <- glm(formula = fx7, data = d[d$Negotiation_lag == 0,], family = binomial(link = "logit"))
mx8 <- glm(formula = fx7, data = d[d$Negotiation_lag == 1,], family = binomial(link = "logit"))
screenreg(list(mx7, mx8))

## model 9: inaugural
mx9 <- glm(formula = fx9, data = d[d$Negotiation_inaugural >= 0,], 
           family = binomial(link = "logit"))

screenreg(list(mx7, mx8, mx9))

vm1 <- mx1
vm2 <- mx2
vm3 <- mx3
vm4 <- mx4
vm7 <- mx7
vm8 <- mx8
vm9 <- mx9

## GWF Categorical ####
d$autlib   <- 0
d$demtrans <- d$demref_gwf_demref_decay5_lag

# Models
# First 4
mx1 <- glm(formula = fx1, data = d, family = binomial(link = "logit"))
mx2 <- glm(formula = fx2, data = d, family = binomial(link = "logit"))
mx3 <- glm(formula = fx3, data = d, family = binomial(link = "logit"))
mx4 <- survival::clogit(fx4, data = d)

screenreg(list(mx1, mx2, mx3, mx4))

# markov transition
mx7 <- glm(formula = fx7, data = d[d$Negotiation_lag == 0,], family = binomial(link = "logit"))
mx8 <- glm(formula = fx7, data = d[d$Negotiation_lag == 1,], family = binomial(link = "logit"))
screenreg(list(mx7, mx8))

## model 9: inaugural
mx9 <- glm(formula = fx9, data = d[d$Negotiation_inaugural >= 0,], 
           family = binomial(link = "logit"))

screenreg(list(mx7, mx8, mx9))

## Table outputs ####
# Model 1
htmlreg(list(lex1,vm1,mx1), file = "catvars_model1.doc", inline.css = FALSE,
        doctype = TRUE, html.tag = TRUE, head.tag = TRUE, body.tag = TRUE,
        stars = c(0.001, 0.01, 0.05, 0.10),
        star.symbol = c("*"),
        symbol = c("&#8224;"),
        caption = "Categorical Dataset Models 1: Negotiation",
        caption.above = T,
        custom.model.names = c("Lexical","V-Dem","GWF"),
        custom.coef.map = list(autlib = "Autocratic Liberalization",
                               demtrans = "Democratic Transition",
                               duration_dy_ln = "Duration",
                               imp.gdppcln = "GDP pc ln",
                               imp.popln = "Pop pc ln",
                               Region2  = "Mid East",
                               Region3  = "Asia",
                               Region4  = "Africa",
                               Region5  = "Americas",
                               tsln     = "Time Since Last Neg.",
                               tsln2    = "Time Since Last Neg.^2",
                               tsln3    = "Time Since Last Neg.^3",
                               Intensity1 = "Minor Conflict",
                               Intensity2 = "Major Conflict",
                               Intercept = "Intercept")
)

# Model 2
htmlreg(list(lex2,vm2,mx2), file = "catvars_model2.doc", inline.css = FALSE,
        doctype = TRUE, html.tag = TRUE, head.tag = TRUE, body.tag = TRUE,
        stars = c(0.001, 0.01, 0.05, 0.10),
        star.symbol = c("*"),
        symbol = c("&#8224;"),
        caption = "Categorical Dataset Models 2: Negotiation",
        caption.above = T,
        custom.model.names = c("Lexical","V-Dem","GWF"),
        custom.coef.map = list(autlib = "Autocratic Liberalization",
                               demtrans = "Democratic Transition",
                               duration_dy_ln = "Duration",
                               imp.gdppcln = "GDP pc ln",
                               imp.popln = "Pop pc ln",
                               Region2  = "Mid East",
                               Region3  = "Asia",
                               Region4  = "Africa",
                               Region5  = "Americas",
                               tsln     = "Time Since Last Neg.",
                               tsln2    = "Time Since Last Neg.^2",
                               tsln3    = "Time Since Last Neg.^3",
                               Intensity1 = "Minor Conflict",
                               Intensity2 = "Major Conflict",
                               RebStrBin.imp = "Rebel Strength",
                               Ethnic.incomp = "Ethnic",
                               medprev2y = "Previous Mediation",
                               Intercept = "Intercept")
)

# Model 4 (Fixed-effect)
htmlreg(list(lex4,vm4,mx4), file = "catvars_model4.doc", inline.css = FALSE,
        doctype = TRUE, html.tag = TRUE, head.tag = TRUE, body.tag = TRUE,
        stars = c(0.001, 0.01, 0.05, 0.10),
        star.symbol = c("*"),
        symbol = c("&#8224;"),
        caption = "Categorical Dataset (Fixed-Effect): Negotiation",
        caption.above = T,
        custom.model.names = c("Lexical","V-Dem","GWF"),
        custom.coef.map = list(autlib = "Autocratic Liberalization",
                               demtrans = "Democratic Transition",
                               duration_dy_ln = "Duration",
                               imp.gdppcln = "GDP pc ln",
                               imp.popln = "Pop pc ln",
                               Region2  = "Mid East",
                               Region3  = "Asia",
                               Region4  = "Africa",
                               Region5  = "Americas",
                               tsln     = "Time Since Last Neg.",
                               tsln2    = "Time Since Last Neg.^2",
                               tsln3    = "Time Since Last Neg.^3",
                               Intensity1 = "Minor Conflict",
                               Intensity2 = "Major Conflict",
                               RebStrBin.imp = "Rebel Strength",
                               Ethnic.incomp = "Ethnic",
                               medprev2y = "Previous Mediation",
                               Intercept = "Intercept")
)

# Model 7 (Categorical Dataset (Markov): Negotiation Onset)
htmlreg(list(lex7,vm7,mx7), file = "catvars_model7.doc", inline.css = FALSE,
        doctype = TRUE, html.tag = TRUE, head.tag = TRUE, body.tag = TRUE,
        stars = c(0.001, 0.01, 0.05, 0.10),
        star.symbol = c("*"),
        symbol = c("&#8224;"),
        caption = "Categorical Dataset (Markov): Negotiation Onset",
        caption.above = T,
        custom.model.names = c("Lexical","V-Dem","GWF"),
        custom.coef.map = list(autlib = "Autocratic Liberalization",
                               demtrans = "Democratic Transition",
                               duration_dy_ln = "Duration",
                               imp.gdppcln = "GDP pc ln",
                               imp.popln = "Pop pc ln",
                               Region2  = "Mid East",
                               Region3  = "Asia",
                               Region4  = "Africa",
                               Region5  = "Americas",
                               tsln     = "Time Since Last Neg.",
                               tsln2    = "Time Since Last Neg.^2",
                               tsln3    = "Time Since Last Neg.^3",
                               Intensity1 = "Minor Conflict",
                               Intensity2 = "Major Conflict",
                               RebStrBin.imp = "Rebel Strength",
                               Ethnic.incomp = "Ethnic",
                               medprev2y = "Previous Mediation",
                               Intercept = "Intercept")
)

# Model 8 : Categorical Dataset (Markov): Negotiation Continuation
htmlreg(list(lex8,vm8,mx8), file = "catvars_model8.doc", inline.css = FALSE,
        doctype = TRUE, html.tag = TRUE, head.tag = TRUE, body.tag = TRUE,
        stars = c(0.001, 0.01, 0.05, 0.10),
        star.symbol = c("*"),
        symbol = c("&#8224;"),
        caption = "Categorical Dataset (Markov): Negotiation Continuation",
        caption.above = T,
        custom.model.names = c("Lexical","V-Dem","GWF"),
        custom.coef.map = list(autlib = "Autocratic Liberalization",
                               demtrans = "Democratic Transition",
                               duration_dy_ln = "Duration",
                               imp.gdppcln = "GDP pc ln",
                               imp.popln = "Pop pc ln",
                               Region2  = "Mid East",
                               Region3  = "Asia",
                               Region4  = "Africa",
                               Region5  = "Americas",
                               tsln     = "Time Since Last Neg.",
                               tsln2    = "Time Since Last Neg.^2",
                               tsln3    = "Time Since Last Neg.^3",
                               Intensity1 = "Minor Conflict",
                               Intensity2 = "Major Conflict",
                               RebStrBin.imp = "Rebel Strength",
                               Ethnic.incomp = "Ethnic",
                               medprev2y = "Previous Mediation",
                               Intercept = "Intercept")
)


# Model 9: Categorical Dataset: Inaugural Negotiation
htmlreg(list(lex9,vm9,mx9), file = "catvars_model9.doc", inline.css = FALSE,
        doctype = TRUE, html.tag = TRUE, head.tag = TRUE, body.tag = TRUE,
        stars = c(0.001, 0.01, 0.05, 0.10),
        star.symbol = c("*"),
        symbol = c("&#8224;"),
        caption = "Categorical Dataset: Inaugural Negotiation",
        caption.above = T,
        custom.model.names = c("Lexical","V-Dem","GWF"),
        custom.coef.map = list(autlib = "Autocratic Liberalization",
                               demtrans = "Democratic Transition",
                               duration_dy_ln = "Duration",
                               imp.gdppcln = "GDP pc ln",
                               imp.popln = "Pop pc ln",
                               Region2  = "Mid East",
                               Region3  = "Asia",
                               Region4  = "Africa",
                               Region5  = "Americas",
                               tsln     = "Time Since Last Neg.",
                               tsln2    = "Time Since Last Neg.^2",
                               tsln3    = "Time Since Last Neg.^3",
                               Intensity1 = "Minor Conflict",
                               Intensity2 = "Major Conflict",
                               RebStrBin.imp = "Rebel Strength",
                               Ethnic.incomp = "Ethnic",
                               medprev2y = "Previous Mediation",
                               Intercept = "Intercept")
)

# Alternative Measurement 2 ####
# Available on Stata .do file 

